package com.shirley.pers.zhufengfmvi.tasks;

import com.shirley.pers.zhufengfmvi.client.ClientAPI;

/**
 * Description: 获取曲目详情的异步任务<br/>
 * <p/>
 * Copyright (c) , 2016, Shirley Xian <br/>
 * This program is protected by copyright laws. <br/>
 * ClassName: TrackDetailTask<br/>
 * Date: 2016/4/8 11:28
 *
 * @author Shirley Xian
 * @version 1.0
 */
public class TrackDetailTask extends BaseTask {
    private long trackId;

    public TrackDetailTask(TaskCallback taskCallback, long trackId) {
        super(taskCallback);
        this.trackId = trackId;
    }

    /**
     * Override this method to perform a computation on a background thread. The
     * specified parameters are the parameters passed to {@link #execute}
     * by the caller of this task.
     * <p/>
     * This method can call {@link #publishProgress} to publish updates
     * on the UI thread.
     *
     * @param params The parameters of the task.
     * @return A result, defined by the subclass of this task.
     * @see #onPreExecute()
     * @see #onPostExecute
     * @see #publishProgress
     */
    @Override
    protected TaskResult doInBackground(String... params) {
        String json = ClientAPI.getTrackDetailById(trackId);
        return getTaskResult(json, new TaskResult());
    }
}
